package cn.tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Controller
public class ShopController {
    private String controller;
    // 1 实例化
    public ShopController() {
        System.out.println("1 通过构造方法实现实例化");
    }
    // 2 属性赋值
    @Value("2 属性赋值: 控制器1")
    public void setController(String controller) {
        this.controller = controller;
        System.out.println("2 通过set方法实现属性赋值");
    }
    // 3 初始化
    @PostConstruct
    public void controller () {
        System.out.println("3 初始化");
    }
    // 5 销毁前
    @PreDestroy
    public void des () {
        System.out.println("5 销毁前逻辑");
    }
}
